<%@page import="me.idashu.attg.domain.UserEntity"%>
<%@page import="me.idashu.attg.domain.GoodsEntity"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
request.setCharacterEncoding("UTF-8");
String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
String ad = String.valueOf(request.getAttribute("ad"));
%>
<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<title>KindEditor JSP</title>
	<link rel="stylesheet" href="/shop/themes/default/default.css" />
	<link rel="stylesheet" href="/shop/plugins/code/prettify.css" />
	<script charset="utf-8" src="/shop/kindeditor.js"></script>
	<script charset="utf-8" src="/shop/lang/zh_CN.js"></script>
	<script charset="utf-8" src="/shop/plugins/code/prettify.js"></script>
	<link href="/shop/resources/css/bootstrap.min.css" rel="stylesheet"
	media="screen">
	<link href="/shop/resources/css/style.css" rel="stylesheet">
	<script src="/shop/resources/js/jquery-1.9.2.min.js"></script>
	<script src="/shop/resources/js/bootstrap.min.js"></script>
	<script src="/shop/resources/js/js.js"></script>
	<script>
		var editor1;
		KindEditor.ready(function(K) {
			editor1 = K.create('textarea[name="posdesc"]', {
				cssPath : '/shop/plugins/code/prettify.css',
				uploadJson : '/shop/jsp/upload_json.jsp',
				fileManagerJson : '/shop/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
					});
				}
			});
			prettyPrint();
		});
		function sendValue() {
			var goods_Id = $("#title").val();
			var adver_Seq = $("#position").val();
			var deal = $("#deal").val();
			var content = editor1.html();
			if ($.trim(goods_Id) == null || $.trim(goods_Id) == "") {

				alert("招聘标题不能为空");
				return;

			}
			if ($.trim(adver_Seq) == null || $.trim(adver_Seq) == "") {

				alert("职位职能不能为空");
				return;
			}
			if ($.trim(deal) == null || $.trim(deal) == "") {
				alert("待遇不能为空");
				return;

			}
			if ($.trim(content) == null || $.trim(content) == "") {

				alert("招聘内容不能为空");
				return;
			}
			$("#posdesc").val(content);
			$('#form1').submit();
		}
	</script>
</head>
<body>
	<ul class="breadcrumb">
		<li><span id="test">您当前的位置：</span><span
			class="divider">>></span></li>
		<li class="active">${addAdver }</li>
	</ul>
	<form class="form-horizontal" method="post"
		action="/shop/shop/addAdverInfo.do" id="form1">
		<input type="hidden" id="shop_id" name="shop_id" value="${shopEntity.id}">
		<div class="control-group">
		    <label class="control-label" for="shop_id">所属商家</label>
		    <div class="controls">
				  <input type="text" id="shopname"  value="${shopEntity.name}" disabled="disabled" />
		    </div>
		  </div>	
		  <div class="control-group">
		    <label class="control-label" for="title">招聘标题</label>
		    <div class="controls">
		      <input type="text" id="title" name="title">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="position">职位职能</label>
		    <div class="controls">
		      <input type="text" id="position" name="position">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="deal">待遇</label>
		    <div class="controls">
		      <input type="text" id="deal" name="deal">
		    </div>
		  </div>
		<div class="control-group">
			<label class="control-label" for="posdesc">招聘内容</label>
			<div class="controls">
				<textarea name="posdesc" id="posdesc" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;"></textarea>
			</div>
		</div>
		<div class="control-group">
			<div class="controls" style="margin-left: 43%;">
				<button type="button" class="btn" onclick="sendValue()">确认添加</button>
			</div>
		</div>
	</form>
</body>
</html>
<%!
private String htmlspecialchars(String str) {
	str = str.replaceAll("&", "&amp;");
	str = str.replaceAll("<", "&lt;");
	str = str.replaceAll(">", "&gt;");
	str = str.replaceAll("\"", "&quot;");
	return str;
}
%>